<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
     <title>医院管理系统</title>    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="jsTools/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="jsTools/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="jsTools/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    
    <script type="text/javascript" src="jsTools/jquery-ui-1.12.1.custom/jquery-ui.js"></script> 
    <link href="jsTools/jquery-ui-1.12.1.custom/jquery-ui.css" rel="stylesheet"></link> 
   
    <script src="jsTools/jquery-validation-1.16.0/dist/jquery.validate.min.js"></script>
    <script src="jsTools/jquery-validation-1.16.0/dist/localization/messages_zh.js"></script>
    <script src="jsTools/jquery-validation-1.16.0/dist/additional-methods.js"></script>
    <style type="text/css">
    	#index{
    	width:100%;
    	position:fixed;
    	z-index: 1;
    	}
    </style>
  </head>
 	<body > 	
 	
 		<div class="container-fluid" id="index"  style="background-color:#CAFFFF">
 			<div  class=" row clearfix " > 	
 				<div class="col-sm-6 column col-sm-offset-6 ">							
 				<ul class="nav nav-tabs" style="float: right;">
				<li id="sign">
				<c:if test="${user.name==null}">				
					<a class="btn.btn-info btn-sm" href="" data-toggle="modal" data-target="#signOne" title="请登录">登录
					</a>
				</c:if>
				<c:if test="${user.name!=null}">
				<img class="img-circle " src="${user.headImage}" width="50" height="50" >
				<h4><span class="label label-info">昵称：${user.name}</span></h4>
				</c:if>	 
					 
				</li>
				<li>
					 <a href="Main/register.do">注册</a>
				</li>
				<li>
					 <a href="Main/forget.do">忘记密码</a>
				</li>
				<li >
					 <a href="#">信息</a>
				</li>
				<li>
					 <a href="outLogin/exit.do">退出</a>
				</li>
				<li>
					 <a href="workerSign.html">工作人员入口</a>
				</li>
				</ul>	
				
				</div>			
 			</div>
 		</div>
 	 
	<div class="col-sm-12" style="background-color: #005AB5 ;margin-top: 85">
		<div class="col-sm-4 col-sm-offset-4" >
		<ul class="nav nav-pills btn-group title" >
				<li   class="active" >			
					 <a  href="javascript:change_fame('Main/news.do')" style=" color: black;">首页</a>
				</li>
				<li  class="active" >
					 <a href="javascript:change_fame('Main/forum.do')" style="color: black;">进入论坛</a>
				</li>
				<li  class="active" >
					 <a href="javascript:change_fame('Main/fileManage.do')" style="color: black;">文件管理</a>
				</li>
				<li  class="active"  >
					 <a href="javascript:change_fame('Main/onlineChat.do)" style="color: black;">在线咨询</a>
				</li>
				<li  class="active"  >
					 <a href="javascript:change_fame('Main/onlineOrder.do')" style="color: black;">在线预约</a>
				</li>
			</ul>
		</div>
	</div>
	<div id="signOne" class="modal fade" title="请登录">
		<div class="modal-dialog">
				<form  class="form-Horizontal" >
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close active" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title" >
								请登录
							</h4>
						</div>
						<div class="modal-body">							
								<div class="form-group">
									 <br>
									 <label for="workerLogin" class="col-sm-4 control-label">邮箱</label>
									<div class="col-sm-5">
										<input class="form-control"  name="email" type="text"  placeholder="邮箱" />
									</div>
								</div>
								
								<div class="form-group">
										
									 <label for="workerPassword" class="col-sm-4 control-label">密码</label><a href="Main/forget.do">忘记密码</a>
									<div class="col-sm-5">
										<input class="form-control "  name="password" type="password" placeholder="密码"/>
									</div>
								</div>	
								<div class="form-group">
									<div id="back" class="col-sm-4 col-sm-offset-4">
																				
									</div>
								</div>																				
						</div>
						<div class="modal-footer">
								<button type="submit" class="btn btn-primary">登录</button>
								<button type="reset" id="cancellation" class="btn btn-primary">重置</button>
						</div>
					</div>	
				</form>		   			 
		</div>
	</div>
	<div class="row clearfix" style="color:  #CAE1FF"">
		<div class="col-md-12 column">
		<iframe frameborder="0"  id="fame" src="Main/news.do"  height="100%" width="100%"></iframe>
		</div>
	</div>
	

	</body>
	<script type="text/javascript">
	  $(".title li").mouseenter(function (){ $(this).removeClass("active");});
	  $(".title li").mouseleave(function (){ $(this).addClass("active");});
	 $(document).ready(	
		function(){
			$("#signOne form").validate({
			  submitHandler:function(form){
			  	//$( "#signOne" ).dialog( "close" );	
			  	//导致有些浏览器卡顿		  	
				// $("#signOne form").submit();
			   var data=$('form').serialize();
			   $.post("outLogin/login.do",data,function(msg){
			   	if(msg.status==200)
			   		{	$("#back").empty() ;
			   			$("#back").prepend("<div class='alert alert-danger'>"+msg.message+"</div>");
			   		}
			   		else{
			   			$('#signOne').modal('hide');
			   			window.location.href="Main/main.do"; 
			   		}			   		
			   		 }
			   );
			 },
			  rules:{
				email:{required:true,
				email:true,				
				},
				password:{required:true,
				},
			},
			errorElement: "em",
				errorPlacement: function ( error, element ) {
					// Add the `help-block` class to the error element
					error.addClass( "help-block" );

					// Add `has-feedback` class to the parent div.form-group
					// in order to add icons to inputs
					element.parents( ".col-sm-5" ).addClass( "has-feedback" );

					if ( element.prop( "type" ) === "checkbox" ) {
						error.insertAfter( element.parent( "label" ) );
					} else {
						error.insertAfter( element );
					}

					// Add the span element, if doesn't exists, and apply the icon classes to it.
					if ( !element.next( "span" )[ 0 ] ) {
						$( "<span class='glyphicon glyphicon-remove form-control-feedback'></span>" ).insertAfter( element );
					}
				},
				success: function ( label, element ) {
					// Add the span element, if doesn't exists, and apply the icon classes to it.
					if ( !$( element ).next( "span" )[ 0 ] ) {
						$( "<span class='glyphicon glyphicon-ok form-control-feedback'></span>" ).insertAfter( $( element ) );
					}
				},
				highlight: function ( element, errorClass, validClass ) {
					$( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
					$( element ).next( "span" ).addClass( "glyphicon-remove" ).removeClass( "glyphicon-ok" );
				},
				unhighlight: function ( element, errorClass, validClass ) {
					$( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
					$( element ).next( "span" ).addClass( "glyphicon-ok" ).removeClass( "glyphicon-remove" );
				}			
			}
				);
		}
		);
   
 
	function change_fame(src)
{
	$("iframe").attr("src",src);
}
	$(document).ready(function(){
			$("#get_head").click(function(){window.location.hash="#head";});
	});
</script>
</html>
